package com.swf.seed.test;

import java.io.IOException;
import java.util.List;

import com.swf.common.utils.FwsFileUtils;
import com.swf.common.utils.FwsIOUtils;
import com.swf.common.utils.FwsPatternUtils;

public class Md5 {
	public static String acontent = "acc_time=20140625141055&address=testaddress&area_code=310053&buyer_cert_no=332521###&buyer_cert_type=1&buyer_name=tzrA&call_number=057128829345&email=12345@qq.com&input_charset=UTF-8&mobile_number=13812345678&partner=1900000107&service_version=1.0&sign_key_index=1&sign_type=MD5&spbill_create_ip=192.168.1.1&tenpay_fund_no=###&transaction_id=###&key=8db4a013a8b515349c307f1e448ce836";
	
	public static void main(String[] args) throws IOException {
		FwsIOUtils io = FwsIOUtils.getInstance();
		io.setAppend(true);
		io.setCharst("UTF-8");
		io.setOutPath("D:/acco/accoSign.txt");
		String content = FwsFileUtils.loadFile("D:/acco/acco.txt", "UTF-8");
		List<String> list = FwsPatternUtils.matchedList(content, "\\d+");
		io.setContent("partnerno,sign");
		io.writeByline();
		for (String s:list){
			io.setContent(s+","+MD5Util.MD5Encode(acontent.replaceAll("###", s), "utf-8").toUpperCase());
			io.writeByline();
		}
	}
}
